
<link rel="stylesheet" href="../addons/jy_business_card/resource/css/music.css" onload="$('#body-html').show()">
<div class="namecard-music" id="body-html">

<!--#=start page-->
<div class="namecard-page">
    <section class="music-column">
        <ul class="v-list music-inner">
            <li ng-repeat="music in pagedata.list" class="v-list-item music-inner-item">
                <div class="music-avatar" ng-click="post_json('post',{music:music.url})">
                    <img ng-src="{{tomedia(music.image)}}"  class="music-avatar-thumbnail" />
                    <span class="music-choose"></span>
                    <h3 class="music-name">{{music.title}}</h3>
                    <p class="music-singer">{{music.author}}</p>
                </div>
                <span class="play-btn" ng-class="{'cur':pagedata.play_index==$index && pagedata.playing}" ng-click="pagedata.play_music($index)"></span>
            </li>
        </ul>
    </section>
</div>
<!--#=end page-->
<audio id="musicPlayer" loop></audio>
</div>
<script>
var audio=document.getElementById('musicPlayer');
scope.pagedata.play_music=function(index){
	if(scope.pagedata.play_index==index){
		if(scope.pagedata.playing){
			scope.pagedata.playing=false;
			audio.pause();
		}else{
			scope.pagedata.playing=true;
			audio.play();
		}
		
	}else{
		
		scope.pagedata.play_index=index;
		scope.pagedata.playing=true;
		scope.$evalAsync();
		$('#musicPlayer').attr('src',scope.tomedia(scope.pagedata.list[index].url));
		audio.play();
	}
}
</script>
